package servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import bean.Company;
import dao.ChartsDao;

public class SearchOutServlet extends HttpServlet{

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request, response);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub

		response.setContentType("text/html;charset=utf-8");
		PrintWriter out = response.getWriter();
		request.setCharacterEncoding("utf-8");
	   	String company_id=request.getParameter("outlet");
	    
//	   	System.out.println(company_id);
		ChartsDao dao=new ChartsDao();
		List<Map> list2=dao.findOutlet(company_id);
		
		String str1="";
		for(Map map2:list2){
			
			str1+="<option value='"+map2.get("outlet_id")+"'>"+map2.get("outlet_name")+"</option>";
			
		}	
		out.print(str1);
		request.setAttribute("list2", list2);
	}		

}
